package com.woniuxy.factory;

import com.woniuxy.person.Person;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ForthFactory {
    public Person getPerson() {
        Properties properties = new Properties();
        InputStream resourceAsStream = ForthFactory.class.getResourceAsStream("person.properties");
        try {
            properties.load(resourceAsStream);
            String chinese = properties.getProperty("chinese");
            Person person = (Person) Class.forName(chinese).newInstance();
            return person;
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException | IOException e) {
            e.printStackTrace();
        }
        return null;
    }

}
